﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Menu_edit_form.aspx.cs" Inherits="SQT.tracnghiem.Admin.SystemSettings.Control.Ajax.Menu.Menu_edit_form" %>

<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <%int id = int.Parse(Request.QueryString["id"]);
        var get_menu = new TblAdminMenuController().FetchAll().Where(x => x.AmId == id).Single();
        var get_menu_parent = new TblAdminMenuController().FetchAll().Where(x => x.AmIsDelete == false && x.AmParentID == 0 && x.AmId != get_menu.AmId);
    %>
    <div class="w3-padding w3-center"><b>Chỉnh sửa</b></div>
    <div class="ss-create-form">
        <div class="w3-row w3-padding">
            <label class="w3-quarter">Danh mục</label>
            <select id="ddl_edit_menu" class="ss-dropdown">
                <option <%if (get_menu.AmParentID == 0)
                    { %>selected="selected"
                    <%} %> value="0">Danh mục cha</option>
                <%foreach (TblAdminMenu parent in get_menu_parent)
                    {
                        if (get_menu.AmParentID != 0)
                        {
                            if (parent.AmId == this.get_parent(get_menu.AmId))
                            {
                %>
                <option selected="selected" value="<%=parent.AmId %>"><%=parent.AmName %></option>
                <%}
                } %>
                <option value="<%=parent.AmId %>"><%=parent.AmName %></option>
                <%} %>
            </select>
        </div>
        <div id="check_child" class="w3-hide"></div>
        <div class="w3-row w3-padding">
            <label class="w3-quarter">Tên danh mục</label><input id="txt_edit_menu_name" value="<%=get_menu.AmName %>" type="text" placeholder="Nhập tên danh mục" />
        </div>
        <div class="w3-row w3-padding">
            <label class="w3-quarter">Biểu tượng</label><input id="txt_edit_menu_icon" value="<%=get_menu.AmIcon %>" type="text" placeholder="Ví dụ: fa fa-home" class="ss-icon-input" /><div class="ss-new-menu-icon w3-teal"><i id="edit_menu_icon" class="<%=get_menu.AmIcon %>"></i></div>
        </div>
        <div class="w3-row w3-padding">
            <label class="w3-quarter">Đường dẫn</label><input type="text" id ="txt_edit_menu_url" value="<%=get_menu.AmUrl %>" placeholder="Ví dụ: ~/Admin/DefaultAdmin.aspx" />
        </div>
        <div class="w3-row w3-padding">
            <label class="w3-quarter">Tên đường dẫn</label><input id="txt_edit_menu_routing" value="<%=get_menu.AmRouting %>" type="text" placeholder="Ví dụ: quan-ly/tong-quan" />
        </div>
        <div class="w3-row w3-padding ss-checkbox">
            <label class="w3-quarter">Chức năng mới</label><%if (get_menu.AmIsUpdate == true)
                                                               { %><input type="checkbox" checked="checked" id="isupdate2" /><%}
    else
    { %><input type="checkbox" id="isupdate2" /><%} %><label for="isupdate2" class="ss-check"></label>
        </div>
        <div class="w3-padding w3-center">
            <a onclick="btn_edited_menu(<%=id %>)" class="w3-btn w3-teal"><i class="fa fa-save"></i>&nbsp;Lưu</a>
            <a onclick="btn_del_menu(<%=id %>)" class="w3-btn w3-teal"><i class="fa fa-trash"></i>&nbsp;Xóa</a>
        </div>
    </div>
</body>
</html>
